require(['./config'],()=>{
    require(['header','footer','jquery'],()=>{
        class register{
            constructor(){
                this.goregister()
            }
            goregister(){
              $('#lj-register').on('click',()=>{
                  const userinfo = {
                      tel:$('#tel').val(),
                      pwd:$('#pwd').val(), 
                  }
                  const pwd2 = $('#pwd2').val()
                  if(userinfo.tel!==''&&userinfo.pwd!==''&&pwd2!==''){
                    if(userinfo.pwd === pwd2){
                        let userList = localStorage.getItem('userList')
                        if(userList){
                            userList = JSON.parse(userList)
                            userList.push(userinfo)
                            localStorage.setItem('userList',JSON.stringify(userList))
                            alert('注册成功')
                        }else{
                            localStorage.setItem('userList',JSON.stringify([userinfo]))
                            alert('注册成功')
                        }
                  }
                
                  }else if(userinfo.tel===''||userinfo.pwd===''||pwd2===''){
                      alert('注册失败')
                  }
                   if(userinfo.pwd!==pwd2){
                    alert('注册失败')
                  } 
                  
              })
            }

        }
        new register()
    })
})